import { createRouter, createWebHistory } from 'vue-router'
// import HomeView from '../views/HomeView.vue'
import Container from '../views/Container.vue'
import IndexComponent from '../components/IndexComponent.vue'
import UserCenterComponent from '../components/parentComponents/UserCenterComponent.vue'
import UpdatePasswordComponent from '../components/childComponents/UpdatePasswordComponent.vue'
import UpdatePhoneComponent from '../components/childComponents/UpdatePhoneComponent.vue'

import CourseFatherComponent from '../components/parentComponents/CourseFatherComponent.vue'
import ListCourseComponent from '../components/childComponents/ListCourseComponent.vue'
import ListEBookComponent from '../components/childComponents/ListEBookComponent.vue'
import ProductDetailsComponent from '../components/childComponents/ProductDetailsComponent.vue'
import PayProductComponent from '../components/childComponents/PayProductComponent.vue'
import MyPostComponent from '../components/childComponents/MyPostComponent.vue'
import MyCollectComponent from '../components/childComponents/MyCollectComponent.vue'
import VideoPlayer from '../components/childComponents/VideoPlayer.vue'
import ProductDetailsChildComponent from '../components/childComponents/ProductDetailsChildComponent.vue'
import LogRegComponent from '../components/childComponents/LogRegComponent.vue'
import LearningRecordComponent from '../components/childComponents/LearningRecordComponent.vue'
import UpdateUserDataComponent from '../components/childComponents/UpdateUserDataComponent.vue'
import PurchaseRecordComponent from '../components/childComponents/PurchaseRecordComponent.vue'
import LogRegComponentVue from '../components/childComponents/LogRegComponent.vue'
import CommunityComponent from '../components/childComponents/CommunityComponent.vue'
import CommontPlusComponent from '../components/childComponents/CommontPlusComponent.vue'
import CommunityChildComponent from '../components/childComponents/CommunityChildComponent.vue'
import PayComponent from '../components/childComponents/PayComponent.vue'
import ChangePicComponent from '../components/childComponents/ChangePicComponent.vue'
import BookComponent from '../components/childComponents/BookComponent.vue'



const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [

    {
      path: '/',
      redirect: '/index'
    }, {
      path: '/login',
      name: 'login',
      component: LogRegComponentVue
    }, {
      path: '/',
      name: 'home',
      component: Container,
      children: [{
        path: '/index',
        name: 'index',
        component: IndexComponent
      }, {
        path: '/bookinfo/:productId',
        name: 'bookinfo',
        component: BookComponent,
      },{
        path: '/ebook',
        name: 'ebook',
        component: ListEBookComponent,
        children: []
      }, {
        path: '/course',
        name: 'course',
        component: CourseFatherComponent,
        children: [{
          path: '/courseList',
          name: 'courseList',
          component: ListCourseComponent,
        }, {
          path: '/course/:productId',
          name: 'product',
          component: ProductDetailsComponent,
          children: [{
            path: '/productVideo/:goodId',
            name: 'productVideo',
            component: VideoPlayer
          }, {
            path: '/productChild/:goodId',
            name: 'productChild',
            component: ProductDetailsChildComponent
          }]
        },]
      }, {
        path: '/user',
        name: 'user',
        component: UserCenterComponent,
        children: [{
          path: '/updatePhone',
          name: 'updatePhone',
          component: UpdatePhoneComponent
        }, {
          path: '/myPost',
          name: 'myPost',
          component: MyPostComponent
        }, {
          path: '/updatePassword',
          name: 'updatePassword',
          component: UpdatePasswordComponent
        }, {
          path: '/learningRecord',
          name: 'learningRecord',
          component: LearningRecordComponent
        }, {
          path: '/myCollect',
          name: 'myCollect',
          component: MyCollectComponent
        }, {
          path: '/updateUserData',
          name: 'updateUserData',
          component: UpdateUserDataComponent,
          children: [{
            path: '/changePic',
            name: 'changePic',
            component: ChangePicComponent,
          }]

        }, {
          path: '/purchaseRecord',
          name: 'purchaseRecord',
          component: PurchaseRecordComponent
        }]
      }, {
        path: '/payProduct/:productId',
        name: 'payProduct',
        component: PayProductComponent
      }, {
        path: '/community',
        name: 'community',
        component: CommunityComponent,
        children: [{
          path: '/postList',
          name: 'postList',
          component: CommunityChildComponent
        }, {
          path: '/comment/:postId',
          name: 'comment',
          component: CommontPlusComponent
        },]
      }, {
        path: '/paygood/:productId',
        name: 'paygood',
        component: PayComponent
      },]
    },


  ]
})

export default router
